<!--
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>新建实体类属性</title>
    <div th:include="common/include::include"/>
    &lt;!&ndash;dev&ndash;&gt;
    &lt;!&ndash;<link href="/static/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="/static/bootstrap/css/bootstrap-table.min.css" rel="stylesheet"/>

    <script src="/static/jquery/jquery-3.2.1.min.js" type="text/javascript"/>&ndash;&gt;
</head>
<body>
<div class="container-fluid">
    <h1 class="page-header">新增实体模型</h1>
    <form class="form-horizontal" name="genCodeForm" action="/enity/save/model" method="post" id="genCodeForm">
        <div class="form-group">
            <label class="col-sm-2 control-label" for="projectName">项目名称</label>
            <div class="col-sm-4">
                <input type="text" id="projectName" name="projectName" class="form-control" th:value="SAMP"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label" for="packageName">包名</label>
            <div class="col-sm-4">
                <input type="text" id="packageName" name="packageName" class="form-control"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label" for="className">类名</label>
            <div class="col-sm-4">
                <input type="text" id="className" name="className" class="form-control" data-toggle="tooltip" data-placement="right" title="必填"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label" for="classDesc">描述</label>
            <div class="col-sm-4">
                <input type="text" id="classDesc" name="classDesc" class="form-control"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label" for="fieldList">字段</label>
            <div class="col-sm-10" id="fieldList">
                <div class="form-group">
                    <div class="col-sm-2">
                        <input type="text" name="fieldList[0].fieldName" placeholder="字段名" class="form-control"/>
                    </div>
                    <div class="col-sm-2">
                        <input type="text" name="fieldList[0].fieldDesc" placeholder="字段描述" class="form-control"/>
                    </div>
                    <div class="col-sm-2">
                        <select name="fieldList[0].fieldType" placeholder="字段类型" class="form-control">
                            <option value="">请选择字段类型</option>
                            <option th:each="fieldTypeEnum:${fieldTypeList}" th:value="${fieldTypeEnum.name()}"
                                    th:text="${fieldTypeEnum.appearType}"/>
                        </select>
                    </div>
                    <div class="col-sm-2">
                        <select name="fieldList[0].necessary" placeholder="是否必要" class="form-control">
                            <option value="">是否必填</option>
                            <option th:each="necessaryEnum:${necessaryList}" th:value="${necessaryEnum.name()}"
                                    th:text="${necessaryEnum.desc}"/>
                        </select>
                    </div>
                </div>
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-primary">提交</button>
                <button type="button" class="btn btn-primary" th:onclick="'javascript:addOneField()'">加字段</button>
                <button type="button" class="btn btn-primary" data-toggle="modal" onclick="viewGenCodeRusult()">预览结果</button>
            </div>
        </div>
    </form>
    <div class="modal fade" tabindex="-1" role="dialog" id="genResultModal" aria-labelledby="genResultModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    <h4 class="modal-title" id="genResultModalLabel">代码生成预览</h4>
                </div>
                <div class="modal-body">
                    <textarea id="genCodeResult" disabled="disabled"/>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" data-dismiss="modal">了解,请关闭</button>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<style type="text/css">
    #genCodeResult {
        margin: 0px;
        width: 574px;
        height: 715px;
    }
</style>
<script type="text/html" id="addFieldHtml" th:inline="text">
    <div class="form-group">
        <div class="col-sm-2">
            <input type="text" name="fieldList[0].fieldName" placeholder="字段名" class="form-control"/>
        </div>
        <div class="col-sm-2">
            <input type="text" name="fieldList[0].fieldDesc" placeholder="字段描述" class="form-control"/>
        </div>
        <div class="col-sm-2">
            <select name="fieldList[0].fieldType" placeholder="字段类型" class="form-control">
                <option value="">请选择字段类型</option>
                <option th:each="fieldTypeEnum:${fieldTypeList}" th:value="${fieldTypeEnum.name()}"
                        th:text="${fieldTypeEnum.appearType}"/>
            </select>
        </div>
        <div class="col-sm-2">
            <select name="fieldList[0].necessary" placeholder="是否必要" class="form-control">
                <option value="">是否必填</option>
                <option th:each="necessaryEnum:${necessaryList}" th:value="${necessaryEnum.name()}"
                        th:text="${necessaryEnum.desc}"/>
            </select>
        </div>
    </div>
</script>

<script type="text/javascript" th:inline="javascript">
    var fieldCount = 0;
    function addOneField() {
        console.log(fieldCount);
        $("#fieldList").append($("#addFieldHtml").html());
        fieldCount++;
    }

//    function viewGenCodeRusult() {
//        console.log('executing it!!!!');
////        $('#genResultModal').modal('toggle');
//        var paramData = {};
//        // 获取Form表单中所有数据
//        var paramForm = $('#genCodeForm').serializeArray();
//        console.log(paramForm);
//        $.each(paramForm, function () { paramData[this.name] = this.value;});
//        console.log(paramData);
//        $.post('/enity/doing/gen', paramData, function (data) {
//            $('#genCodeResult').val(data);
//            $('#genResultModal').modal('toggle');
//        })
//    }
</script>
</html>-->
